1. Field of the Invention
The present invention relates to computer networks. More specifically, the present invention relates to a method and an apparatus for buffering data at a transport layer on a client.
2. Related Art
Byte-stream oriented protocols, like the Transmission Control Protocol (TCP), typically do not possess any notion of message boundaries. As a result, the receive-side stack implementation often relies on heuristics to determine when to wake up a client which is blocking, waiting for more data to read. For example, TCP uses heuristics like the presence of the PSH flag (a flag which instructs the transport layer to “push” the buffered data to the application layer), and the reception of a partial segment, to decide when to send up all the data temporarily buffered at the transport layer. These heuristics serve to reduce the number of unnecessary wakeups and read( ) system calls. However, this technique typically does not work well without the help of the application. Consequently, in most cases, the wakeup is either too early or too late.
With the rapid proliferation of resource-constrained computing devices, such as web-enabled cell phones and Personal Digital Assistants (PDAs), processing extra wakeups and read( ) system calls can be relatively expensive. Existing approaches to minimize this impact are far from optimal because they make assumptions about network traffic. Since network traffic is dynamic in nature, and these assumptions are typically represented by static variables, the existing approach cannot adapt to dynamic changes in the network, and they are typically optimized for greatest-use cases (which means they achieve sub-optimal performance for other cases).
Hence, what is needed is a method and an apparatus for buffering data at the transport layer without the problems discussed above.